package kr.co.waitnumber.site.management.controller;


import kr.co.waitnumber.site.management.service.WaitNumberService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Locale;


/**
 * CheckMileage Controller : 회원 및 가맹점 관리 사이트 기능
 */
public class WaitNumberController extends MultiActionController {



    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(WaitNumberController.class);

    @Autowired
    private WaitNumberService waitNumberService = null;
    @Autowired
    private LocaleResolver localeResolver = null;



    /**
     * 언어 설정을 바꾼다.
     *
     * @param request
     * @param response
     * @return
     */
    public ModelAndView changeLocale(HttpServletRequest request, HttpServletResponse response) {
        String language = request.getParameter("language");
        Locale locale = new Locale(language);
        localeResolver.setLocale(request, response, locale);
        return new ModelAndView("intro");
    }

    /**
     * index 페이지로 이동한다.
     *
     * @param request HttpServletRequest
     * @param response HttpServletReponse
     * @return ModelAndView
     */
    public ModelAndView index(HttpServletRequest request, HttpServletResponse response) {


        logger.info("index");

        return new ModelAndView("index");
    }




    ///////////////////////////////////////
    // Spring Framework Setter Injection //
    ///////////////////////////////////////



}
